package cn.techjc.action;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.techjc.service.TestService;

@Controller
public class TestAction {
	private static Logger log = Logger.getLogger(TestAction.class);


	@Autowired
	TestService testService;

	@RequestMapping("/test")
	@ResponseBody
	public Map<String, Object> test(HttpServletResponse response, HttpSession session)  {
		Map<String,Object> map = new HashMap<>();
		map.put("code",1);
		map.put("message","OK");
		map.put("data",testService.getUsers());
		return map;
	}

	@RequestMapping("/test2")
	@ResponseBody
	public Map<String, Object> test2(HttpServletResponse response, HttpSession session)  {
		Map<String,Object> map = new HashMap<>();
		map.put("code",1);
		map.put("message","OK");
		map.put("data",testService.getUsersNumByRedis());
		return map;
	}

}
